<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sitemesh" uri="http://www.opensymphony.com/sitemesh/decorator" %>
<!DOCTYPE html>
<html lang="en"
      class="app js no-touch no-android chrome no-firefox no-iemobile no-ie no-ie8 no-ie10 no-ie11 no-ios no-ios7 ipad">
<head>
    <title>用户登录</title>
</head>
<body>
<div class="bg-info dker" style="height:100% ; width:100%; position:absolute;">
    <section id="content" class="m-t-lg wrapper-md animated fadeInUp">
        <div class="container aside-xl">
            <a class="navbar-brand block" href="/"><span class="h1 font-bold">AgileSay</span></a>
            <section class="m-b-lg">
                <header class="wrapper text-center">
                    <strong>登录到AgileSay</strong>
                </header>
                <form id="loginForm">
                    <div class="form-group">
                        <input placeholder="注册邮箱|用户名" data-bv-notempty data-bv-notempty-message="用户名不能为空"
                               name="username" class="form-control rounded input-lg text-center no-border">
                    </div>
                    <div class="form-group">
                        <input type="password" placeholder="登录密码" data-bv-notempty data-bv-notempty-message="登录密码不能为空"
                               name="password" class="form-control rounded input-lg text-center no-border">
                    </div>
                    <button name="submit" id="submit" type="submit"
                            class="btn btn-lg btn-warning lt b-white b-2x btn-block btn-rounded">
                        <i class="icon-arrow-right pull-right"></i><span class="m-r-n-lg">登录</span>
                    </button>
                    <div class="text-center m-t m-b">
                        <a href="/forget/password">
                            <small>忘记密码?</small>
                        </a></div>
                    <div class="line line-dashed"></div>
                    <p class="text-muted text-center">
                        <small>还没有账号?</small>
                    </p>
                    <a href="/register"
                       class="btn btn-lg btn-info btn-block rounded">创建一个</a>
                </form>
            </section>
        </div>
    </section>
    <!-- footer -->
    <footer id="footer">
        <div class="text-center padder">
            <p>
                <small>github开源项目，发起人apesay<br>© 2016</small>
            </p>
        </div>
    </footer>
</div>
<script type="text/javascript">
    $(function () {
        $('#loginForm').bootstrapValidator({}).on('success.form.bv', function (e) {
            // Prevent form submission
            e.preventDefault();
            // Get the form instance
            var $form = $(e.target);
            // Get the BootstrapValidator instance
            var bv = $form.data('bootstrapValidator');
            // Use Ajax to submit form data
            $.post("/dologin", $form.serialize(), function (data) {
                console.log(data)
                if (data == "success") {
                    window.location.href = "/kanban/board_list";
                } else {
                    showMsg(data);
                    document.getElementById("submit").disabled = false;//使可用
                }
            });
        });
    });
</script>
</body>
</html>